package com.baojee.index.controller;

import com.baojee.index.entity.PageItem;
import com.baojee.index.entity.ResponseResult;
import com.baojee.index.service.IndexService;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @Auther: mg
 * @Date: 2021/06/22/18:01
 * @Description:
 */

@RestController
@RequestMapping("/index")
public class IndexDataController {

    private final String type = "shop:app:firstpage:icon:";

    @Resource
    private IndexService indexService;

    @RequestMapping(value = "/data.action", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public ResponseResult findDataV6() {

        return this.indexService.findAppIndexDataV6();
    }


    @RequestMapping(value = "/icons", method = RequestMethod.GET)
    public Map findIconList() {
        LinkedHashMap<String, Object> resultMap = new LinkedHashMap<>();
            List<PageItem> iconList = this.indexService.getIconList(type);
            resultMap.put("iconList",iconList);
            return resultMap;


    }


}
